package org.lee.app.impl;

import org.lee.app.AuthInfo;
import org.lee.app.AuthLink;
import org.lee.app.service.AuthService;

import java.util.Date;

/**
 * Level1AuthLink
 * 一级审核
 *
 * @author dralee
 * @date 2021-11-23 10:02:47
 **/
public class Level1AuthLink extends AuthLink {

    public Level1AuthLink(String levelUserId, String levelUserName) {
        super(levelUserId, levelUserName);
    }

    @Override
    public AuthInfo doAuth(String uId, String orderId, Date authDate) {
        Date date = AuthService.queryAuthInfo(levelUserId, orderId);
        if (null == date) {
            return new AuthInfo("01", "单号：", orderId, "状态：待一级审批负责人", levelUserName);
        }
        AuthLink next = super.next();
        if (null == next) {
            return new AuthInfo("00", "单号：", orderId, "状态：一级审批完成负责", " 时间：", sdf.format(date), " 审批人：", levelUserName);
        }
        return next.doAuth(uId, orderId, authDate);
    }
}
